package testcases;

import static org.junit.Assert.*;

import org.junit.Test;

import code.CreditCard;

public class CreditCardTest {
	CreditCard standardlimit;
	CreditCard upperlimit;

	public void runTest() {
		standardlimit = new CreditCard("Billy", "1 main st.", "Seattle", "12345", "USA");
		upperlimit = new CreditCard("Joe", "3rd C st.", "Tacoma", "67890", "USA",5000);
		testFields();
		testPay();
		
	}
	
	public void testFields(){
		assertEquals("Billy", standardlimit.fName);
		assertEquals("1 main st.", standardlimit.fStreet);
		assertEquals("Seattle", standardlimit.fTown);
		assertEquals("12345", standardlimit.fzipCode);
		assertEquals("USA", standardlimit.fCountry);
		assertEquals(2500.00, standardlimit.fLimit, 1.0);
		assertEquals(0.0, standardlimit.fBalance,0.0);
		
		assertEquals("Joe", upperlimit.fName);
		assertEquals("3rd C st.", upperlimit.fStreet);
		assertEquals("Tacoma", upperlimit.fTown);
		assertEquals("67890", upperlimit.fzipCode);
		assertEquals("USA", upperlimit.fCountry);
		assertEquals(5000.00, upperlimit.fLimit, 1.00);
		assertEquals(0.0, upperlimit.fBalance, 0.0);
		
	}
	
	public void testPay(){
		assertFalse(standardlimit.pay(10.00));
		assertFalse(upperlimit.pay(100.00));
		
		assertTrue(standardlimit.pay(2600.00));
		
	}

}
